<template>
	<div>




		<div class="header">




			<van-nav-bar style="  background: linear-gradient(90deg, #FF6D00,#FFB500 , #FF6D00);height: 5rem;line-height: 5rem;">

				<span class="title" slot="title">资料填写</span>


				<span style="font-size: 1.5625rem ; color: white; font-weight: 500;" slot="right">
					<van-button type="primary" color="#FFAE00" @click="back">&nbsp;返&nbsp;&nbsp;&nbsp;回&nbsp;</van-button>
				</span>
				
				
			</van-nav-bar>

		</div>



		<div class="content" style=" text-align: center;	width:100%; background:url(./images/background.png) no-repeat; background-size:100% 100%; ">

		

				




		</div>
	</div>

</template>

<script>
	export default {


		data() {
			return {
				total_fee: 0,
				ledList: [{
					code: "A1"
				}, {
					code: "A2"
				}],
				userName: '',
				phoneNumber: '',
				qifu: '',
				errormessage: '',
				options: [{
					value: '福如东海，寿比南山！',
					label: '福如东海，寿比南山！'
				}, {
					value: '阿弥陀佛',
					label: '阿弥陀佛'
				}, {
					value: '选项3',
					label: '蚵仔煎'
				}, {
					value: '选项4',
					label: '龙须面'
				}, {
					value: '选项5',
					label: '北京烤鸭'
				}],
				value: ''



			}
		},
		methods: {

			back() {
				//this.$router.go(-1);
				this.$router.push("gongfo");
			},


			clickGetValue() {
				alert(1);
				let v = this.getIframeValue();
				this.total_fee = v[3];

				console.log(this.total_fee);
			},

			submit() {
				let v = this.getIframeValue();
				//数据初始化
				//let total_fee = this.$route.query.total_fee;

				let total_fee = v[3];
				this.total_fee = total_fee;
				
				console.log("---------------------------------------->",this.total_fee);
				let ledList = this.$route.query.ledList;

				this.ledList = ledList;

				console.log("this.ledList===============", this.ledList);
				let day = this.$route.query.day;
				//验证数据
				if (v[0] == '') {
					//this.errormessage = "姓名不能为空！";
					this.$toast.fail({
						message: '姓名不能为空！'
					});

					return;
				} else if (v[1] == '') {
					//this.errormessage = "手机号不能为空！";
					this.$toast.fail({
						message: '手机号不能为空！'
					});
					return;
				} else if (!/^1[3456789]\d{9}$/.test(v[1])) {
					//this.errormessage = "手机号码格式不正确！";
					this.$toast.fail({
						message: '手机号码格式不正确！'
					});
					return;
				} else {
					this.errormessage = "";
				}


				if (v[3] == 0 || v[3] == "0") {
					this.$toast.fail({
						message: '请选择供佛时长！'
					});
					return;
				}




				//旧版
				this.$router.push({
					path: '/GongfoStep1',
					query: {
						total_fee: total_fee,
						ledList: ledList,
						day: day,
						userName: v[0],
						phoneNumber: v[1],
						qifutext: v[2]
					}
				});





			},
			//获取页面的元素值
			getIframeValue() {
				var x = document.getElementById("iframe").contentWindow.document;
				let v1 = x.getElementById("userName").value;
				let v2 = x.getElementById("phoneNumber").value;
				let v3 = x.getElementById("qifu").value;
				let v4 = x.getElementById("total_fee").value;
				return [v1, v2, v3, v4];
			}




		},

		created() {

			this.ledList = this.$route.query.ledList;

			console.log("this.ledList===============", this.ledList);


		},
		mounted() {





			/* 	window.onload=function (){
					
					var x = document.getElementById("iframe").contentWindow.document;
					//x = window.frames[0];
					//console.log(x.document);
					//x.document.getElementsByTagName("body")[0].style.backgroundColor = "blue";
					alert(x.getElementById("userName").value+x.getElementById("phoneNumber").value,)
					
				} */




			//let obj1 = window.frames["child"];

			/* console.log("..........")

			console.log(iframe.contentWindow.document);
			console.log(this.$el.getElementsByTagName('iframe')[0].contentWindow.document);

			console.log(this.$el.getElementsByTagName('iframe')[0].contentWindow.NodeModule); */
			//let str = this.$el.getElementsByTagName('iframe')[0].contentWindow.document.getElementById('instr').value;



			//let inputvalue = document.getElementById("iframe").contentWindow.document.getElementById("txt_Search").value;


			//document.getElementById("iframe").srcdoc='';

		}

	}
	
	
	
</script>

<style>
	#st0 {
		height: 3.125rem;
		width: 12rem;

		/* 	position: absolute;
		bottom: 2rem;
		left: 47%; */
		margin-top: 1rem;

		text-align: center;





	}

	.pc {
		font-size: 1rem;
	}


	/*
	 
	消除滚动条，牛逼 
	 */
	.select::-webkit-scrollbar {
		display: none
	}
</style>
